#include <iostream>
#include <string>

// 友元就是让一个函数或者类访问另一个类中的私有成员
class Building
{
    friend void goodGay(Building *building);    // 全局函数做友元
public:
    Building()
    {
        m_SittingRoom = "sitting room";
        m_BedRoom = "bed room";
    }
public:
    std::string m_SittingRoom;  // 客厅
private:
    std::string m_BedRoom;  // 卧室
};

// 全局函数
void goodGay(Building *building)
{
    std::cout<< "goodGay is visit "<< building->m_SittingRoom << std::endl;
    std::cout<< "goodGay is visit "<< building->m_BedRoom << std::endl;
}

void test01()
{
    Building building;
    goodGay(&building);
}

int main()
{
    test01();
    
    return 0;
}